﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace DearlerPlatform.Common
{
    public class ApiResult<T>
    {
        public bool status { get; set; }
        public string msg { get; set; }
        public T data { get; set; }
        public static ApiResult<T> Fail(string errorMsg) => new() { status=false, msg=errorMsg };
        public static ApiResult<T> Success(string successMsg, T successData) => new() { status = true, msg = successMsg, data = successData };
        public string ToJsonString() => JsonSerializer.Serialize(this);
    }   
}
